﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class admin_Site_Config : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        AdminCs.CheckLoginState();
        if (!this.IsPostBack)
        {
            site_Txt();
        }
    }
    private void site_Txt()
    {
        DataTable dt = Class1.ExecSel("select * from Site_Config");
        TextBox1.Text = Convert.ToString(dt.Rows[0]["WS_Title"]);
        TextBox2.Text = Convert.ToString(dt.Rows[0]["WS_keywords"]);
        TextBox3.Text = Convert.ToString(dt.Rows[0]["WS_description"]);
        TextBox4.Text = Convert.ToString(dt.Rows[0]["WS_Smtp"]);
        TextBox5.Text = Convert.ToString(dt.Rows[0]["WS_User"]);
        TextBox6.Text = Convert.ToString(dt.Rows[0]["WS_Pwd"]);
        //if (dt.Rows[0]["WS_Reg"].ToString() == "1")
        //{
        //    CheckBox1.Checked = true;
        //}
        //else
        //{
        //    CheckBox1.Checked = false;
        //}

    }
    private void site_config()
    {
        string WS_Reg;
        string WS_Title = TextBox1.Text;
        string WS_keywords = TextBox2.Text;
        string WS_description = TextBox3.Text;
        //if (this.CheckBox1.Checked)
        //{
        //    WS_Reg = "1";

        //}
        //else
        //{

        //    WS_Reg = "0";
        //}
        string WS_Smtp = TextBox4.Text;
        string WS_User = TextBox5.Text;
        string WS_Pwd = TextBox6.Text;


        string sql = ("update Site_Config set WS_Title='" + WS_Title + "',WS_keywords='" + WS_keywords + "',WS_description='" + WS_description + "',WS_Smtp='" + WS_Smtp + "',WS_User='" + WS_User + "',WS_Pwd='" + WS_Pwd + "'");
        Class1.ExecSql(sql);
        Class1.AlertShow("修改成功！", "Site_Config.aspx");
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        site_config();
    }
}
